package com.firmiana.jt809.connection;

import com.firmiana.jt809.entity.BizConnection;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * @author hucl
 * @date 2020/8/26 10:22
 */
public class ConnectionManager {
    // 子链路连接信息容器
    //key 接入码， value 连接信息
    private final static ConcurrentMap<String, BizConnection> subConnectMap = new ConcurrentHashMap<>();


    public static ConcurrentMap<String, BizConnection> getAllSubConnections() {
        return ConnectionManager.subConnectMap;
    }

    public static void put(String platformId, BizConnection connection) {
        ConnectionManager.subConnectMap.put(platformId, connection);
    }

    public static BizConnection get(String key) {
        return ConnectionManager.subConnectMap.get(key);
    }

}
